Okay, so last lesson, you were just introduced to the concept of coding and scripting in your game.
Now today we are going to get into a little bit of code.
This is just something very basic.
Just to start you off.
And next lesson I think is when we're probably starting the main concepts.
Okay.
As you just need a bit of an introduction before we get into get right into all the coding and stuff.
Okay.
So if you haven't already got one, open up a script and put it up.
Open it up in your game and it will appear something like this here.
Okay.
So this is where you can write your code okay.
Now currently it says print some brackets and hello world okay.
We're going to explain what that is.
Um, just in a minute.
But um, what happens if we run the game with this?
Well, you can see in the output it says a little message here saying hello world, which is what it
printed just here.
So we're going to explain how that happens today.
Okay.
Um, so one more thing that could be useful for you to know with your scripts, okay, is that you can
zoom in and zoom out, um, by using.
Well, for me it is commands plus to zoom in and command minus to zoom out.
But it will depend on what device you're using.
Um, I believe for anyone on a windows computer, it would be control.
But, um, just try out some buttons and see which ones work.
It will be, um, control or option and plus and minus.
Okay.
Um, but yeah.
So, um, how this works is, um, this print word here.
Um, this is a function.
Okay.
And this function, what it allows us to do is it allows us to print whatever is written inside of the
brackets.
Okay.
Brackets.
Um, people elsewhere in the world will refer to them as parentheses.
Okay.
Um, I'm going to refer to them as brackets because that's what they're called from where I live.
But, um, if you are getting a bit confused.
Brackets and parentheses mean the same thing, but I'm going to be referring to them as brackets.
Okay.
So um, this print keyword, um, where it's a print function, but it's the name of the function.
Okay.
So print is the name of this function here.
Okay.
And how functions work is you first need to say the function's name which is print okay.
Then with all functions you include a pair of brackets afterwards okay.
And inside those brackets you could write some additional information that the function needs to know
in order to work.
Okay.
So this this print function puts a message into the output okay.
You can't just write print normally like that.
It needs to know more information.
The extra information it needs to know is the message you're wanting to print okay.
Otherwise it can't print anything.
It doesn't know what to print.
Okay.
Um, so which is why inside we've written here hello, world.
I've done it automatically.
Okay.
The other bit to explain is why we have these speech marks here.
Um, another thing that we will get onto, um, later on, you understand a bit better later on, but,
um, whenever you want to write, um, normal text, you use speech marks.
Um, this is so it doesn't get confused with other things.
As a great example of this is that let's say you want to print the word print.
Okay.
Let's say the print function put in our brackets and then let's write the word print.
It's now getting confused because it thinks we're referring to the print to a print function.
But we're not.
We're trying to print the word print, not the function okay.
Which is why we use a pair of pair of um, um, sorry, a pair of speech marks here.
Um, because it tells the script that what we're writing inside here, even if it's, it's the, um,
the same word as a function.
We're not using that function.
We're just using the word okay.
And that's that's called using a string.
Okay.
But if you're not, understand that quite, quite just yet, that's completely fine.
This is the first lesson of coding.
And later on in a few lessons time.
We will look at strings in a bit more detail.
Okay.
As for why we use why we use brackets after functions again, it's something you will learn later on.
Okay.
With with learning how to script, you have kind of got to just understand that you do this because
that's how it's done.
Okay.
But later on you will understand why.
But I can't understand why because that will get all into functions, which is a later topic.
Okay.
Um, but that's that's it.
You need to know for printing.
Okay.
Print a message into the output.
You need a pair of brackets after you write print.
And also a pair of speech marks okay.
A similar function to print is called warn, which does the exact same thing, but in a bolder, more
obvious font.
And the reason why you might want to warn something is if it's very important.
More important than something you print instead.
Okay, so the warn function, its name is warn.
So we're going to say its name warn okay.
And it's a function.
So we include a pair of brackets a pair of speech marks because we're wanting to write text and write
in your string.
So write in what you want to warn.
So let's just write this message was warned okay.
Let's run the game and see what happens.
You can see here.
It's warned.
My message here.
I've also got another message that was warned up here.
This was from the studio.
Um, this here was from what I did here.
Okay.
So that's my printed message.
And.
And that's my warned message there.
Okay.
Um, one more thing to speed up your typing when you are scripting is that when I'm typing, you can
see a little menu here appears on some stuff that I could write.
Okay.
Once you see what you want to be written highlighted.
So I want to write the print function.
It's got it here I want to I want to I want to use that once it's highlighted in blue like it is here.
You can just press enter and it will do it all for you.
So it finished finished writing the word print and also puts in your brackets for you as well.
So that's very, very useful when it comes to scripting.
So you can write things a lot easier.
And make a lot of a lot less little mistakes.
Okay.
So um, there you go.
Very the very basics to scripting.
Okay.
Just a little introduction really.
And next lesson we're going to learn about referencing, which is the first kind of major part of scripting.